/**
 * 
 */
package org.jeecg.modules.car.service;

import java.util.HashMap;
import java.util.Map;

/**
 * @author LS
 * 全局共通常量
 */
public interface IParkConstants {
	/** 返回标志KEY */
	public static final String RET_FLG_KEY = "flg";
	/** 返回消息KEY */
	public static final String RET_MSG_KEY = "info";
	/** 返回标志 1:成功 */
	public static final String RET_FLG_SUCCESS = "1";
	/** 返回标志 0:失败 */
	public static final String RET_FLG_ERROR = "0";
	/**
	 * 创建含错误消息的Map
	 * @param msg 错误消息
	 * @return map
	 */
	default Map<String, Object> createErrorMap(String msg) {
		return createErrorMap(null, msg);
	}
	/**
	 * 创建含错误消息的Map
	 * @param map
	 * @param msg 错误消息
	 * @return map
	 */
	default Map<String, Object> createErrorMap(Map<String, Object> map, String msg) {
		if (map == null) map = new HashMap<>();
		map.put(RET_FLG_KEY, RET_FLG_ERROR);
		map.put(RET_MSG_KEY, msg);
		return map;
	}
	/**
	 * 创建正常Map
	 * @param map
	 * @param msg 错误消息
	 * @return map
	 */
	default Map<String, Object> createMap(Map<String, Object> map, String msg) {
		if (map == null) map = new HashMap<>();
		map.put(RET_FLG_KEY, RET_FLG_SUCCESS);
		map.put(RET_MSG_KEY, msg);
		return map;
	}
	/**
	 * 创建正常Map
	 * @param map
	 * @param key 错误消息
	 * @param val
	 * @return map
	 */
	default Map<String, Object> createMap(Map<String, Object> map, String key, Object val) {
		if (map == null) map = new HashMap<>();
		map.put(RET_FLG_KEY, RET_FLG_SUCCESS);
		map.put(key, val);
		return map;
	}
	
	default boolean isEqual(Object obj1, Object obj2) {
		if (obj1 == obj2) return true;
		String s1 = obj1 == null ? "" : obj1.toString();
		String s2 = obj2 == null ? "" : obj2.toString();
		return s1.equals(s2);
	}
	
	default String concat(Object... objects) {
		StringBuffer sb = new StringBuffer();
		for (Object object : objects) {
			sb.append(object == null ? "" : String.valueOf(object));
		}
		return sb.toString();
	}
	default String ifnull(Object object) {
		return ifnull(object, "");
	}
	default String ifnull(Object object, String def) {
		return object == null ? def : String.valueOf(object);
	}

	/** 审核理由:用户初次申请 */
	public static final String LABEL_CHECK_REASON_APPLI = "用户初次申请";
	/** 审核理由:用户重新申请 */
	public static final String LABEL_CHECK_REASON_REAPPLI = "用户重新申请";
	/** 审核理由:客服审核 */
	public static final String LABEL_CHECK_REASON_CUSTOMER = "客服审核";
	/** 审核理由:财务审核 */
	public static final String LABEL_CHECK_REASON_ACCOUNTANT = "财务审核";
	/** 审核理由:续费 */
	public static final String LABEL_CHECK_REASON_PAY1 = "续费1";
	/** 审核理由:续费 */
	public static final String LABEL_CHECK_REASON_PAY2 = "续费2";
	/** 审核理由:远程同步 */
	public static final String LABEL_CHECK_REASON_SYNC = "远程同步";
	/** 审核理由:用户初次申请 */
	public static final int CHECK_REASON_APPLI = 0;
	/** 审核理由:用户重新申请 */
	public static final int CHECK_REASON_REAPPLI = 1;
	/** 审核理由:客服审核 */
	public static final int CHECK_REASON_CUSTOMER = 2;
	/** 审核理由:财务审核 */
	public static final int CHECK_REASON_ACCOUNTANT = 3;
	/** 审核理由:续费 */
	public static final int CHECK_REASON_PAY1 = 4;
	/** 审核理由:续费 */
	public static final int CHECK_REASON_PAY2 = 5;
	/** 审核理由:远程同步 */
	public static final int CHECK_REASON_SYNC = 6;
	
	
	/** 外系统车场类型:JGS */
	public static final String SYS_JGS = "JGS";
	
	//是否需要指定房产 0:不需要(页面不显示房产选择) 1:需要但房产无需认证 2:需要且房产需认证
	/** 是否需要指定房产 0:不需要(页面不显示房产选择) */
	public static final int ROOM_NEED_FLAG_NONE = 0;
	/** 是否需要指定房产 1:需要但房产无需认证 */
	public static final int ROOM_NEED_FLAG_NEED = 1;
	/** 是否需要指定房产 2:需要且房产需认证 */
	public static final int ROOM_NEED_FLAG_AUTHEN = 2;
	
	/** 停车类型 0:临停 */
	public static final int CAR_TYPE_TEMP = 0;
	/** 停车类型 1:月卡 */
	public static final int CAR_TYPE_MONTH = 1;

	/** 外系统状态 0:正常 */
	public static final int CAR_STATE_NORMAL = 0;
	/** 外系统状态 1:停止 */
	public static final int CAR_STATE_STOP = 1;
	/** 外系统状态 2:暂停 */
	public static final int CAR_STATE_PAUSE = 2;

	/** 外系统同步状态 0:正常 */
	public static final int SYN_STATUS_NORMAL = 0;
	/** 外系统同步状态 1:异常 */
	public static final int SYN_STATUS_ERROR = 1;
	//审核状态 -3:未绑定(外系统刚导入) -2 失效 -1 审核未通过 0:待审核 1:审核通过
	/** 审核状态 -3:未绑定(外系统刚导入) */
	public static final int CHECK_STATUS_UNBIND = -3;
	/** 审核状态 -2:失效 */
	public static final int CHECK_STATUS_INVALID = -2;
	/** 审核状态 -1:审核未通过 */
	public static final int CHECK_STATUS_NOT_PASSED = -1;
	/** 审核状态 0:待审核 */
	public static final int CHECK_STATUS_WAITING = 0;
	/** 审核状态 1:审核通过 */
	public static final int CHECK_STATUS_PASSED = 1;
	
	//物业费绑定标志 0:不绑定,1:绑定且停车月份不能超过物业费已缴月份,2:绑定且停车月份能超过物业费已缴月份且超出部分按另外单价
	/** 物业费绑定标志 0:不绑定 */
	public static final int PROPERTY_FEE_BIND_NONE = 0;
	/** 物业费绑定标志 1:绑定且停车月份不能超过物业费已缴月份 */
	public static final int PROPERTY_FEE_BIND_YES1 = 1;
	/** 物业费绑定标志 2:绑定且停车月份能超过物业费已缴月份且超出部分按另外单价 */
	public static final int PROPERTY_FEE_BIND_YES2 = 2;
	
	//订单支付状态  0:订单审核中,1:订单审核通过待支付,2:支付中,3:凭证提交中,4:凭证确认中,5:支付成功,
	//            90:订单审核失败,93:订单凭证确认失败,94:订单失效 99:支付失败或用户取消
	/** 订单支付状态 0:订单审核中 */
	public static final int PAY_STATUS_BILL_CHECKING = 0;
	/** 订单支付状态 1:订单审核通过待支付 */
	public static final int PAY_STATUS_WAITING = 0;
	/** 订单支付状态 2:支付中 */
	public static final int PAY_STATUS_PAYING = 2;
	/** 订单支付状态 3:凭证提交中 */
	public static final int PAY_STATUS_EVIDENCE_SUBMITTING = 3;
	/** 订单支付状态 4:凭证确认中 */
	public static final int PAY_STATUS_EVIDENCE_CHECHING = 4;
	/** 订单支付状态 5:支付成功 */
	public static final int PAY_STATUS_PAID = 1;
	/** 订单支付状态 90:订单审核失败 */
	public static final int PAY_STATUS_BILL_CHECK_FAILED = 90;
	/** 订单支付状态 93:订单凭证确认失败 */
	public static final int PAY_STATUS_EVIDENCE_CHECH_FAILED = 93;
	/** 订单支付状态 94:订单失效 */
	public static final int PAY_STATUS_BILL_INVALID = 94;
	/** 订单支付状态 99:支付失败或用户取消 */
	public static final int PAY_STATUS_CANCEL = 99;
	
	
	//订单记录更新原因 0:创建订单 1:订单审核 2:支付中 3:凭证提交 4:凭证确认 5:支付成功 93:凭证重新提交 94:订单失效 99:支付失败或取消
	/** 订单支付状态 0:订单审核中 */
	public static final String LABEL_PAY_STATUS_BILL_CHECKING = "创建订单";
	/** 订单支付状态 1:订单审核通过待支付 */
	public static final String LABEL_PAY_STATUS_WAITING = "订单审核";
	/** 订单支付状态 2:支付中 */
	public static final String LABEL_PAY_STATUS_PAYING = "支付中";
	/** 订单支付状态 3:凭证提交中 */
	public static final String LABEL_PAY_STATUS_EVIDENCE_SUBMITTING = "凭证提交";
	/** 订单支付状态 4:凭证确认中 */
	public static final String LABEL_PAY_STATUS_EVIDENCE_CHECHING = "凭证确认";
	/** 订单支付状态 5:支付成功 */
	public static final String LABEL_PAY_STATUS_PAID = "支付成功";
	/** 订单支付状态 90:订单审核失败 */
	public static final String LABEL_PAY_STATUS_BILL_CHECK_FAILED = "订单审核失败";
	/** 订单支付状态 93:订单凭证确认失败 */
	public static final String LABEL_PAY_STATUS_EVIDENCE_CHECH_FAILED = "凭证重新提交";
	/** 订单支付状态 94:订单失效 */
	public static final String LABEL_PAY_STATUS_BILL_INVALID = "订单失效";
	/** 订单支付状态 99:支付失败或用户取消 */
	public static final String LABEL_PAY_STATUS_CANCEL = "支付失败或取消";
}
